#[derive(Debug, serde::Serialize)]
pub struct FileContent {
	pub name: String,
	pub content: String,
}

impl FileContent {
	pub fn get_abs_path(&self, cluster_name: &String) -> String {
		let file_path = String::from("invalid file path");

		if !self.name.starts_with(cluster_name) {
			return file_path;
		}

		let idx = self.name.find('/');
		if idx.is_none() {
			return file_path;
		}
		let idx = idx.unwrap();

		String::from(&self.name.as_str()[idx..self.name.len()])
	}
}
